﻿using System;

namespace Unity.Type.BinaryType
{
    public static class MetadataExceptionHelper
    {
        public static void ThrowCountOutOfRangeException(int count)
        => throw new ArgumentOutOfRangeException(nameof(count), $"Outside allowed range: count = {count}");

        public static void ThrowInvalidOperationException()
        => throw new InvalidOperationException();

        public static void ThrowIndexOutOfRangeException(int index)
        => throw new IndexOutOfRangeException($"index out of range: index={index}");

        public static void ThrowWhenSpanLengthTooSmall(int length)
        => throw new ArgumentOutOfRangeException(nameof(length), $"destination.Length={length} is too small.");

        public static void ThrowWhenSpanLengthTooLarge(int length)
        => throw new ArgumentOutOfRangeException(nameof(length), $"source.Length={length} is too large");
    }
}
